//
// Created by Administrator on 2021/5/24.
//
#include "iostream"

using namespace std;

void swap01(int q1, int q2){
    int temp1 = q1;
    q1 = q2;
    q2 = temp1;
}

void swap02(int *p1, int *p2){
    int temp = *p1;
    *p1 = *p2;
    *p2 = temp;
}

int main(){

    int a = 10;
    int b = 20;
    //1.值传递

    swap01(a, b);
    cout << "a = " << a << endl;
    cout << "b = " << b << endl;

    //2.地址传递

    swap02(&a, &b);

    cout << "a = " << a << endl;
    cout << "b = " << b << endl;

    system("pause");

    return 0;
}